home *** CD-ROM | disk | FTP | other *** search
- package regex;
-
- class RTree {
- public static final int OP_EMPTY = 0;
- public static final int OP_CHAR = 1;
- public static final int OP_CONCAT = 2;
- public static final int OP_UNION = 3;
- public static final int OP_CLOSURE = 4;
- public static final int OP_LHEAD = 5;
- public static final int OP_LTAIL = 6;
- private int operation;
- private Chars chars;
- private RTree left;
- private RTree right;
-
- public int operation() {
- return this.operation;
- }
-
- public void removeChars(Chars var1) {
- if (this.operation == 1 && this.chars.hasChars(var1)) {
- if (var1.begin() <= this.chars.begin() && this.chars.end() <= var1.end()) {
- this.chars.setType(4);
- return;
- }
-
- if (var1.begin() <= this.chars.end() && this.chars.end() <= var1.end()) {
- this.chars.setEnd((char)(var1.begin() - 1));
- } else if (var1.begin() <= this.chars.begin() && this.chars.begin() <= var1.end()) {
- this.chars.setBegin((char)(var1.end() + 1));
- } else if (this.chars.begin() <= var1.begin() && var1.end() <= this.chars.end()) {
- this.operation = 3;
- this.left = new RTree(new Chars(this.chars.begin(), (char)(var1.begin() - 1)));
- this.right = new RTree(new Chars((char)(var1.end() + 1), this.chars.end()));
- }
- }
-
- if (this.left != null) {
- this.left.removeChars(var1);
- }
-
- if (this.right != null) {
- this.right.removeChars(var1);
- }
-
- }
-
- public RTree(Chars var1) {
- this(1, var1, (RTree)null, (RTree)null);
- }
-
- public RTree(int var1, RTree var2, RTree var3) {
- this(var1, (Chars)null, var2, var3);
- }
-
- public RTree(int var1, Chars var2, RTree var3, RTree var4) {
- this.operation = var1;
- this.chars = var2;
- this.left = var3;
- this.right = var4;
- }
-
- public RTree left() {
- return this.left;
- }
-
- public RTree right() {
- return this.right;
- }
-
- public Chars chars() {
- return this.chars;
- }
- }
-